import request from '@/utils/request'

/**
 * 获取所有频道
 * @param {*} params
 * @returns promise
 */
export const getAllChannel = () => {
  return request({
    url: '/v1_0/channels'
  })
}

/**
 * 新增用户频道
 * @returns promise
 */
export const addChannel = channel => {
  return request({
    url: '/v1_0/user/channels',
    method: 'PATCH', // 和POST传参一样
    data: {
      channels: [channel]
    }
  })
}

/**
 * 删除用户频道
 * @returns promise
 */
export const deleteChannel = id => {
  return request({
    url: '/v1_0/user/channels/' + id,
    method: 'DELETE'
  })
}
